package com.hongyi.app.controller;


import com.hongyi.app.entity.UserNo;
import com.hongyi.app.service.UserNoService;
import com.hongyi.app.util.Result;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

/**
 * @author HongYi
 */
@RequestMapping(value = "/api/v1/user-no")
@Controller
@Data
@Slf4j
public class UserNoController {


    private UserNoService userNoService;

    /**
     *查询一个可用编号
     * cli:http://localhost:8080/api/v1/user-no/select-available-user-no
     * @return
     */
    @ResponseBody
    @RequestMapping(value = "/select-available-user-no",method = RequestMethod.GET)
    public Result selectAvailableByUserNo(){
        log.info("接收到一个请求，查询一个可用编号");
        return  Result.ok(userNoService.selectUnusedByUserNo());

    }
}
